include( 'shared.lua' )
include( "cl_nw.lua" )

function ccm_name()

ccmnameframe = vgui.Create('DFrame')
ccmnameframe:SetSize(552, 163)
ccmnameframe:Center()
ccmnameframe:SetTitle('Community Creative Mod')
ccmnameframe:ShowCloseButton(false)
ccmnameframe:SetBackgroundBlur(true)
ccmnameframe:SetDraggable(false)
ccmnameframe:MakePopup()

ccmdpanel = vgui.Create('DPanel')
ccmdpanel:SetParent(ccmnameframe)
ccmdpanel:SetSize(536, 126)
ccmdpanel:SetPos(7, 29)

ccmnamelabel = vgui.Create('DLabel')
ccmnamelabel:SetParent(ccmdpanel)
ccmnamelabel:SetPos(12, 9)
ccmnamelabel:SetText('Name')
ccmnamelabel:SizeToContents()
ccmnamelabel:SetTextColor(Color(173, 255, 47, 255))
ccmnameentry = vgui.Create('DTextEntry')
ccmnameentry:SetParent(ccmdpanel)
ccmnameentry:SetSize(216, 25)
ccmnameentry:SetPos(12, 24)
ccmnameentry:SetText('')
ccmnameentry.OnEnter = function()
-- penis
end

ccmnameaccept = vgui.Create('DButton')
ccmnameaccept:SetParent(ccmdpanel)
ccmnameaccept:SetSize(70, 25)
ccmnameaccept:SetPos(231, 24)
ccmnameaccept:SetText('Accept')
ccmnameaccept.DoClick = function()
RunConsoleCommand("ccm_setname", "\"" .. ccmnameentry:GetValue() .. "\"")
ccmnameframe:Remove()
end
end
concommand.Add( "ccm_namemenu", ccm_name )

function ccm_model()

ccmmodelframe = vgui.Create('DFrame')
ccmmodelframe:SetSize(757, 211)
ccmmodelframe:Center()
ccmmodelframe:SetTitle('Community Creative Mod')
ccmmodelframe:SetDeleteOnClose(false)
ccmmodelframe:ShowCloseButton(false)
ccmmodelframe:SetBackgroundBlur(true)
ccmmodelframe:MakePopup()

DPanel2 = vgui.Create('DPanel')
DPanel2:SetParent(ccmmodelframe)
DPanel2:SetSize(739, 176)
DPanel2:SetPos(8, 29)


ccmmodellabel = vgui.Create('DLabel')
ccmmodellabel:SetParent(DPanel2)
ccmmodellabel:SetPos(10, 3)
ccmmodellabel:SetText('Appearance')
ccmmodellabel:SizeToContents()
ccmmodellabel:SetTextColor(Color(173, 255, 47, 255))

SpawnIcon1 = vgui.Create('SpawnIcon')
SpawnIcon1:SetParent(DPanel2)
SpawnIcon1:SetPos(285, 19)

ccmpreviewlabel = vgui.Create('DLabel')
ccmpreviewlabel:SetParent(DPanel2)
ccmpreviewlabel:SetPos(287, 4)
ccmpreviewlabel:SetText('Preview')
ccmpreviewlabel:SizeToContents()
ccmpreviewlabel:SetTextColor(Color(173, 255, 47, 255))

DComboBox = vgui.Create('DMultiChoice')
DComboBox:SetParent(DPanel2)
DComboBox:SetPos(8, 19)
DComboBox:SetSize( 261, 21 )
DComboBox:AddChoice("models/player/Group01/male_01.mdl")
DComboBox:AddChoice("models/player/Group01/male_02.mdl")
DComboBox:AddChoice("models/player/Group01/male_03.mdl")
DComboBox:AddChoice("models/player/Group01/male_04.mdl")
DComboBox:AddChoice("models/player/Group01/male_05.mdl")
DComboBox:AddChoice("models/player/Group01/male_06.mdl")
DComboBox:AddChoice("models/player/Group01/male_07.mdl")
DComboBox:AddChoice("models/player/Group01/male_08.mdl")
DComboBox:AddChoice("models/player/Group01/male_09.mdl")
DComboBox:AddChoice("models/player/Group01/Female_01.mdl")
DComboBox:AddChoice("models/player/Group01/Female_02.mdl")
DComboBox:AddChoice("models/player/Group01/Female_03.mdl")
DComboBox:AddChoice("models/player/Group01/Female_04.mdl")
DComboBox:AddChoice("models/player/Group01/Female_06.mdl")
DComboBox:AddChoice("models/player/Group01/Female_07.mdl")
DComboBox.OnMousePressed = function() end
DComboBox.OnSelect = function(index,value,data)
	CurModel = tostring( DComboBox:GetOptionText( value ) )
	SpawnIcon1:SetModel( CurModel )
end

DButton2 = vgui.Create('DButton')
DButton2:SetParent(DPanel2)
DButton2:SetSize(103, 25)
DButton2:SetPos(353, 19)
DButton2:SetText('Accept')
DButton2.DoClick = function()
if ( CurModel == nil ) then 
	print("You need to select a model.")
else
	RunConsoleCommand( "ccm_setmodel", CurModel )
	ccmmodelframe:Remove()
end
end
end
concommand.Add( "ccm_modelmenu", ccm_model )